1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Moved audio CD burner/reader to juce_audio_utils

This commit is contained in:
hogliux 2016-10-20 14:33:02 +01:00
parent bd3166afc0
commit 3e7b5993ca
12 changed files with 79 additions and 64 deletions

View file

@ -45,7 +45,6 @@
#define Component CarbonDummyCompName
#import <CoreAudio/AudioHardware.h>
#import <CoreMIDI/MIDIServices.h>
#import <DiscRecording/DiscRecording.h>
#import <AudioToolbox/AudioServices.h>
#undef Point
#undef Component
@ -88,15 +87,6 @@
#include <iasiodrv.h>
#endif
#if JUCE_USE_CDBURNER
/* You'll need the Platform SDK for these headers - if you don't have it and don't
need to use CD-burning, then you might just want to set the JUCE_USE_CDBURNER flag
to 0, to avoid these includes.
*/
#include <imapi.h>
#include <imapierror.h>
#endif
//==============================================================================
#elif JUCE_LINUX
#if JUCE_ALSA
@ -143,7 +133,6 @@ namespace juce
#include "audio_io/juce_AudioIODeviceType.cpp"
#include "midi_io/juce_MidiMessageCollector.cpp"
#include "midi_io/juce_MidiOutput.cpp"
#include "audio_cd/juce_AudioCDReader.cpp"
#include "sources/juce_AudioSourcePlayer.cpp"
#include "sources/juce_AudioTransportSource.cpp"
#include "native/juce_MidiDataConcatenator.h"
@ -153,14 +142,6 @@ namespace juce
#include "native/juce_mac_CoreAudio.cpp"
#include "native/juce_mac_CoreMidi.cpp"
#if JUCE_USE_CDREADER
#include "native/juce_mac_AudioCDReader.mm"
#endif
#if JUCE_USE_CDBURNER
#include "native/juce_mac_AudioCDBurner.mm"
#endif
//==============================================================================
#elif JUCE_IOS
#include "native/juce_ios_Audio.cpp"
@ -183,14 +164,6 @@ namespace juce
#include "native/juce_win32_ASIO.cpp"
#endif
#if JUCE_USE_CDREADER
#include "native/juce_win32_AudioCDReader.cpp"
#endif
#if JUCE_USE_CDBURNER
#include "native/juce_win32_AudioCDBurner.cpp"
#endif
//==============================================================================
#elif JUCE_LINUX
#if JUCE_ALSA
@ -203,10 +176,6 @@ namespace juce
#include "native/juce_linux_JackAudio.cpp"
#endif
#if JUCE_USE_CDREADER
#include "native/juce_linux_AudioCDReader.cpp"
#endif
//==============================================================================
#elif JUCE_ANDROID
#include "native/juce_android_Audio.cpp"

View file

@ -117,21 +117,6 @@
#endif
#endif
//==============================================================================
/** Config: JUCE_USE_CDREADER
Enables the AudioCDReader class (on supported platforms).
*/
#ifndef JUCE_USE_CDREADER
#define JUCE_USE_CDREADER 0
#endif
/** Config: JUCE_USE_CDBURNER
Enables the AudioCDBurner class (on supported platforms).
*/
#ifndef JUCE_USE_CDBURNER
#define JUCE_USE_CDBURNER 0
#endif
//==============================================================================
namespace juce
{
@ -144,8 +129,6 @@ namespace juce
#include "midi_io/juce_MidiOutput.h"
#include "sources/juce_AudioSourcePlayer.h"
#include "sources/juce_AudioTransportSource.h"
#include "audio_cd/juce_AudioCDBurner.h"
#include "audio_cd/juce_AudioCDReader.h"
#include "audio_io/juce_AudioDeviceManager.h"
}

View file

@ -40,6 +40,19 @@
#include <juce_gui_extra/juce_gui_extra.h>
#endif
#if JUCE_MAC
#import <DiscRecording/DiscRecording.h>
#elif JUCE_WINDOWS
#if JUCE_USE_CDBURNER
/* You'll need the Platform SDK for these headers - if you don't have it and don't
need to use CD-burning, then you might just want to set the JUCE_USE_CDBURNER flag
to 0, to avoid these includes.
*/
#include <imapi.h>
#include <imapierror.h>
#endif
#endif
namespace juce
{
@ -51,17 +64,50 @@ namespace juce
#include "gui/juce_AudioAppComponent.cpp"
#include "players/juce_SoundPlayer.cpp"
#include "players/juce_AudioProcessorPlayer.cpp"
#include "audio_cd/juce_AudioCDReader.cpp"
#if JUCE_MAC
#include "native/juce_mac_BluetoothMidiDevicePairingDialogue.mm"
#include "../juce_core/native/juce_osx_ObjCHelpers.h"
#if JUCE_USE_CDREADER
#include "native/juce_mac_AudioCDReader.mm"
#endif
#if JUCE_USE_CDBURNER
#include "native/juce_mac_AudioCDBurner.mm"
#endif
#elif JUCE_IOS
#include "native/juce_ios_BluetoothMidiDevicePairingDialogue.mm"
#elif JUCE_ANDROID
#include "native/juce_android_BluetoothMidiDevicePairingDialogue.cpp"
#elif JUCE_LINUX
#if JUCE_USE_CDREADER
#include "native/juce_linux_AudioCDReader.cpp"
#endif
#include "native/juce_linux_BluetoothMidiDevicePairingDialogue.cpp"
#elif JUCE_WINDOWS
#include "native/juce_win_BluetoothMidiDevicePairingDialogue.cpp"
#include "../juce_core/native/juce_win32_ComSmartPtr.h"
#if JUCE_USE_CDREADER
#include "native/juce_win32_AudioCDReader.cpp"
#endif
#if JUCE_USE_CDBURNER
#include "native/juce_win32_AudioCDBurner.cpp"
#endif
#endif
}

View file

@ -55,6 +55,21 @@
#include <juce_audio_formats/juce_audio_formats.h>
#include <juce_audio_processors/juce_audio_processors.h>
//==============================================================================
/** Config: JUCE_USE_CDREADER
Enables the AudioCDReader class (on supported platforms).
*/
#ifndef JUCE_USE_CDREADER
#define JUCE_USE_CDREADER 0
#endif
/** Config: JUCE_USE_CDBURNER
Enables the AudioCDBurner class (on supported platforms).
*/
#ifndef JUCE_USE_CDBURNER
#define JUCE_USE_CDBURNER 0
#endif
//==============================================================================
namespace juce
{
@ -69,6 +84,8 @@ namespace juce
#include "gui/juce_BluetoothMidiDevicePairingDialogue.h"
#include "players/juce_SoundPlayer.h"
#include "players/juce_AudioProcessorPlayer.h"
#include "audio_cd/juce_AudioCDBurner.h"
#include "audio_cd/juce_AudioCDReader.h"
}

View file

@ -33,7 +33,7 @@ StringArray AudioCDReader::getAvailableCDNames()
return names;
}
AudioCDReader* AudioCDReader::createReaderForCD (const int index)
AudioCDReader* AudioCDReader::createReaderForCD (const int)
{
return nullptr;
}
@ -46,8 +46,8 @@ void AudioCDReader::refreshTrackLengths()
{
}
bool AudioCDReader::readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer,
int64 startSampleInFile, int numSamples)
bool AudioCDReader::readSamples (int**, int, int,
int64, int)
{
return false;
}
@ -57,12 +57,12 @@ bool AudioCDReader::isCDStillPresent() const
return false;
}
bool AudioCDReader::isTrackAudio (int trackNum) const
bool AudioCDReader::isTrackAudio (int) const
{
return false;
}
void AudioCDReader::enableIndexScanning (bool b)
void AudioCDReader::enableIndexScanning (bool)
{
}
@ -71,7 +71,7 @@ int AudioCDReader::getLastIndex() const
return 0;
}
Array<int> AudioCDReader::findIndexesInTrack (const int trackNumber)
Array<int> AudioCDReader::findIndexesInTrack (const int)
{
return Array<int>();
}

View file

@ -82,12 +82,12 @@ private:
sendSuperclassMessage (self, @selector (dealloc));
}
static void cleanupTrackAfterBurn (id self, SEL, DRTrack*) {}
static BOOL cleanupTrackAfterVerification (id self, SEL, DRTrack*) { return true; }
static void cleanupTrackAfterBurn (id, SEL, DRTrack*) {}
static BOOL cleanupTrackAfterVerification (id, SEL, DRTrack*) { return true; }
static uint64_t estimateLengthOfTrack (id self, SEL, DRTrack*)
{
return getSource (self)->lengthInFrames;
return static_cast<uint64_t> (getSource (self)->lengthInFrames);
}
static BOOL prepareTrack (id self, SEL, DRTrack*, DRBurn*, NSDictionary*)
@ -136,13 +136,13 @@ private:
source->readPosition += numSamples;
}
return numSamples * 4;
return static_cast<uint32_t> (numSamples * 4);
}
return 0;
}
static uint32_t producePreGapForTrack (id self, SEL, DRTrack*, char* buffer,
static uint32_t producePreGapForTrack (id, SEL, DRTrack*, char* buffer,
uint32_t bufferLength, uint64_t /*address*/,
uint32_t /*blockSize*/, uint32_t* /*flags*/)
{
@ -150,7 +150,7 @@ private:
return bufferLength;
}
static BOOL verifyDataForTrack (id self, SEL, DRTrack*, const char*,
static BOOL verifyDataForTrack (id, SEL, DRTrack*, const char*,
uint32_t /*bufferLength*/, uint64_t /*address*/,
uint32_t /*blockSize*/, uint32_t* /*flags*/)
{
@ -186,7 +186,7 @@ struct OpenDiskDevice
{
NSMutableDictionary* p = [[track properties] mutableCopy];
[p setObject: [DRMSF msfWithFrames: numFrames] forKey: DRTrackLengthKey];
[p setObject: [DRMSF msfWithFrames: static_cast<UInt32> (numFrames)] forKey: DRTrackLengthKey];
[p setObject: [NSNumber numberWithUnsignedShort: 2352] forKey: DRBlockSizeKey];
[p setObject: [NSNumber numberWithInt: 0] forKey: DRDataFormKey];
[p setObject: [NSNumber numberWithInt: 0] forKey: DRBlockTypeKey];
@ -268,7 +268,7 @@ class AudioCDBurner::Pimpl : public Timer
public:
Pimpl (AudioCDBurner& b, int deviceIndex) : owner (b)
{
if (DRDevice* dev = [[DRDevice devices] objectAtIndex: deviceIndex])
if (DRDevice* dev = [[DRDevice devices] objectAtIndex: static_cast<NSUInteger> (deviceIndex)])
{
device = new OpenDiskDevice (dev);
lastState = getDiskState();

View file

@ -295,7 +295,7 @@ private:
//==============================================================================
HANDLE createSCSIDeviceHandle (const char driveLetter)
{
TCHAR devicePath[] = { '\\', '\\', '.', '\\', driveLetter, ':', 0, 0 };
TCHAR devicePath[] = { L'\\', L'\\', L'.', L'\\', static_cast<TCHAR> (driveLetter), L':', 0, 0 };
DWORD flags = GENERIC_READ | GENERIC_WRITE;
HANDLE h = CreateFile (devicePath, flags, FILE_SHARE_WRITE | FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
@ -312,7 +312,7 @@ void findCDDevices (Array<CDDeviceDescription>& list)
{
for (char driveLetter = 'b'; driveLetter <= 'z'; ++driveLetter)
{
TCHAR drivePath[] = { driveLetter, ':', '\\', 0, 0 };
TCHAR drivePath[] = { static_cast<TCHAR> (driveLetter), L':', L'\\', 0, 0 };
if (GetDriveType (drivePath) == DRIVE_CDROM)
{